package com.firmboy.proxy.jdk.demo1;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author firmboy
 * @create 2018-06-19 下午1:07
 **/
public class MyInvocationHandler implements InvocationHandler {

    private Object target;

    public MyInvocationHandler(Object target){
        super();
        this.target = target;
    }


    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("执行之前");

        Object invoke = method.invoke(target, args);

        System.out.println("执行之后");

        return invoke;
    }
}
